home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
misc
/
emu
/
ATUtilities.lha
/
ATUtilities
/
M2
/
FILESPEC.DEF
< prev
next >
Wrap
Text File
|
2000-09-26
|
2KB
|
96 lines
DEFINITION MODULE FileSpec;
(* (C) Copyright 1987,1988 Fitted Software Tools. All rights reserved. *)
(*
The procedures in this module help the user manipulate path names.
These procedures do not actually check the validity of a path
name: they just break the components up, based on the DOS syntax
for a path name.
Example: ParseFileSpec will return for '\m2\comp' a dir of 'm2' and
a filename of 'comp' even if '\m2\comp' is the name of an existing
directory.
*)
PROCEDURE ParseFileSpec(
filespec :ARRAY OF CHAR;
VAR drive :CHAR;
VAR dir :ARRAY OF CHAR;
VAR name :ARRAY OF CHAR;
VAR ext :ARRAY OF CHAR
);
(* Description of output:
Only those portions present in filespec will be returned;
the other fields will be loaded with a null in the first
position.
drive: the specified drive
dir: the specified directory path
name: the file name specified, stripped of the extension
ext: the file name extension
*)
(* Example:
ParseFileName( "d:m2\comp\mc.mod", drive, dir, name, ext );
would return:
drive = "d"
dir = "m2\comp"
name = "mc"
ext = "mod"
*)
PROCEDURE ExtractDirPath( filespec :ARRAY OF CHAR; VAR dir :ARRAY OF CHAR );
(*
returns the filespec without the file name portion in dir
*)
(* Example:
ExtractDirName( "d:m2\comp\mc.mod", dir );
would return:
dir = "d:m2\comp"
*)
PROCEDURE ExtractFileName( filespec :ARRAY OF CHAR; VAR name :ARRAY OF CHAR );
(*
returns in name, the file name portion of filespec
*)
(* Example:
ExtractFileName( "d:m2\comp\mc.mod", name );
would return:
name = "mc.mod"
*)
PROCEDURE DropExt( filespec :ARRAY OF CHAR; VAR newspec :ARRAY OF CHAR );
(*
returns filespec less the file name extension in newspec
*)
(* Example:
ExtractFileName( "d:m2\comp\mc.mod", newspec );
would return:
newspec = "d:m2\comp\mc"
*)
PROCEDURE HasExt( filespec :ARRAY OF CHAR ) :BOOLEAN;
(*
TRUE if filespec includes extension
*)
END FileSpec.